package com.hlt.hltapps.adp;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;




import com.hlt.hltapps.R;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.squareup.picasso.Picasso;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MainGridViewAdapter extends BaseAdapter {
	Context context;
	List<Map<String, Object>> dates = new ArrayList<Map<String, Object>>();
private MainGridViewAdapter(Context context,List<Map<String, Object>> dates){
	this.context = context;
	this.dates =dates;
}
@Override
public int getCount() {
	return dates.size();
}

@Override
public Object getItem(int arg0) {
	return dates.get(arg0);
}

@Override
public long getItemId(int arg0) {
	return arg0;
}

@SuppressLint("NewApi")
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
	ViewHolder holder;
	if(arg1 == null){
		holder = new ViewHolder();
		arg1 = LayoutInflater.from(context).inflate(R.layout.main_gridview_item, null);
		ViewUtils.inject(holder, arg1);
		arg1.setTag(holder);
	}else{
		holder = (ViewHolder)arg1.getTag();
	}
	holder.textView1.setText(dates.get(arg0)+"");
	holder.imageView1.setBackground((Drawable) dates.get(arg0));

	
	
	return arg1;
}


private class ViewHolder{
	@ViewInject(R.id.textView1)
	TextView textView1;
	@ViewInject(R.id.imageView1)
	ImageView imageView1;
	
}

}
